<template>
  <view class="sellType">
    <uv-radio-group
      :value="modelValue.merchantCategory"
      :customStyle="customStyleGroup"
      @change="change"
    >
      <uv-radio
        v-for="(item, index) in radiolist"
        :key="index"
        :label="item.name"
        :name="item.type"
        activeColor="rgba(54, 161, 238, 1)"
        :customStyle="customStyleItem"
        size="26rpx"
        labelSize="26rpx"
      >
      </uv-radio>
    </uv-radio-group>
  </view>
</template>

<script setup>
import { ref, toRef, inject, computed, watch, nextTick } from "vue";

import { sellType as radiolist } from "/utils/enums/index.js";

const rules = inject("rules");

const props = defineProps({
  modelValue: {
    type: Object,
    default: () => {},
  },
});
const modelValue = toRef(props, "modelValue");
const emit = defineEmits(["update:modelValue"]);

console.log("modelValue", modelValue.value);

const change = (name) => {
  emit("update:modelValue", {
    ...props.modelValue,
    merchantCategory: name,
  });
};

const customStyleGroup = {
  display: "flex",
  justifyContent: "space-around",
};

const customStyleItem = {
  color: "#333333",
};
</script>

<style lang="scss">
.sellType {
  padding: 23rpx 20rpx;
}
</style>
